import requests
import json


#返回商品分类的函数
def re_proudct_grpup():
    import HenDaFuinterface.InterFace.token as token
    token = token.token()  # 获取token
    headers = {'content-type': 'application/json', 'token': token}  # 请求头
    payload = {}
    ret = requests.post("http://shop.5913ex.com/api/v1/goodsCategory/getList", data=json.dumps(payload),headers=headers)
    # print(ret.text)
    groupdata = ret.json()
    if groupdata['code'] == 0:
        msg = 'ok'
    else:
        msg = '请求服务器失败'

    groupdata['msg'] = msg  # 添加错误信息
    #print(json.dumps(groupdata))
    return json.dumps(groupdata,ensure_ascii=False)



